package com.fqcar.fqdf.ui.main.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.text.Html;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.fqcar.fqdf.R;
import com.fqcar.fqdf.entity.CarInfo;
import com.fqdf.framework.android.util.AndroidUtils;
import com.fqdf.framework.android.util.CheckLogicUtil;
import com.fqdf.framework.android.util.Constants;
import com.fqdf.framework.android.view.GlideCircleTransform;
import com.rd.PageIndicatorView;
import com.rd.animation.type.AnimationType;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;


public class MainViewHelper implements MainViewInterface {


    @BindView(R.id.main_todo_iv)
    ImageView mainTodoIv;
    @BindView(R.id.main_city_name_tv)
    TextView mainCityNameTv;
    @BindView(R.id.main_city_name_total_count_tv)
    TextView main_city_name_total_count_tv;
    @BindView(R.id.main_city_name_layout)
    LinearLayout mainCityNameLayout;
    @BindView(R.id.main_car_list_btn)
    Button mainCarListBtn;
    @BindView(R.id.main_search_btn)
    Button mainSearchBtn;
    @BindView(R.id.main_car_count)
    TextView mainCarCount;
    @BindView(R.id.main_select_condition_btn)
    Button mainSelectConditionBtn;
    @BindView(R.id.main_order_tip_layout)
    RelativeLayout mainOrderTipLayout;
    @BindView(R.id.main_car_plate_num)
    TextView mainCarPlateNum;
    @BindView(R.id.main_car_brand)
    TextView mainCarBrand;
    @BindView(R.id.main_car_state)
    TextView mainCarState;
    @BindView(R.id.main_car_mileage)
    TextView main_car_mileage;
    @BindView(R.id.main_car_battery)
    TextView mainCarBattery;
    @BindView(R.id.main_car_charge_state)
    TextView mainCarChargeState;
    @BindView(R.id.main_car_machine_state)
    TextView mainCarMachineState;
    @BindView(R.id.main_car_address)
    TextView mainCarAddress;
    @BindView(R.id.main_car_distance)
    TextView mainCarDistance;
    @BindView(R.id.main_car_state_desc)
    TextView mainCarStateDesc;
    @BindView(R.id.main_car_state_desc_time)
    TextView mainCarStateDescTime;
    @BindView(R.id.main_car_operation)
    TextView mainCarOperation;
    @BindView(R.id.main_bottom_btn_reporting)
    Button mainBottomBtnReporting;
    @BindView(R.id.main_bottom_btn_nav)
    Button mainBottomBtnNav;
    @BindView(R.id.main_bottom_btn_control)
    Button mainBottomBtnControl;
    @BindView(R.id.main_bottom_llyt)
    LinearLayout mainBottomLlyt;
    // 主界面的RootView
    private View mContentView;

    private Context mContext;

    public MainViewHelper(Context context, View contentView) {
        mContentView = contentView;
        mContext = context;
        ButterKnife.bind(this, contentView);
    }

    @Override
    public void updateCityName(String city) {
        mainCityNameTv.setText(city);
    }

    @Override
    public void showSelCarView() {
        mainBottomLlyt.setVisibility(View.VISIBLE);
    }

    @Override
    public void hidenSelCarView() {
        mainBottomLlyt.setVisibility(View.GONE);
    }

    @Override
    public void updateCityCarTotalCount(String carTotalCount) {
        main_city_name_total_count_tv.setText(carTotalCount);
    }

    @Override
    public void updateCarCount(String carCount) {
        mainCarCount.setText(carCount);
    }

    @Override
    public void showOrderTipLayout() {
        mainOrderTipLayout.setVisibility(View.VISIBLE);
    }

    @Override
    public void hidenOrderTipLayout() {
        mainOrderTipLayout.setVisibility(View.GONE);
    }

    @Override
    public void updateCarPlateNum(String carPlateNum) {
        mainCarPlateNum.setText(carPlateNum);
    }

    @Override
    public void updateCarBrand(String carBrand) {
        mainCarBrand.setText(carBrand);
    }

    @Override
    public void updateCarState(String carState) {
        mainCarState.setText(carState);
    }

    @Override
    public void updateCarMileage(String carMileage) {
        main_car_mileage.setText(carMileage);
    }

    @Override
    public void updateCarBattery(String carBattery) {
        mainCarBattery.setText(carBattery);
    }

    @Override
    public void updateCarCharingState(String carChargingState) {
        mainCarChargeState.setText(carChargingState);
    }

    @Override
    public void updateMachineState(String machineState) {
        mainCarMachineState.setText(machineState);
    }

    @Override
    public void updateCarAddress(String carAddress) {
        mainCarAddress.setText(carAddress);
    }

    @Override
    public void updateDistance(String distance) {
        mainCarDistance.setText(distance);
    }

    @Override
    public void updateCarStateDesc(String carStateDesc) {
        mainCarStateDesc.setText(carStateDesc);
    }

    @Override
    public void updateCarStateDescTime(String carStateDescTime) {
        mainCarStateDescTime.setText(!CheckLogicUtil.isEmpty(carStateDescTime) ? Html.fromHtml(carStateDescTime) : Constants.BLANK);
//        mainCarStateDescTime.setText(Html.fromHtml(carStateDescTime));
//        mainCarStateDescTime.setTextColor(AndroidUtils.getColor(mContext,textColor));
    }

    @Override
    public void updateOperation(String operation) {
        mainCarOperation.setText(operation);
    }

    @Override
    public Context getContext() {
        return null;
    }
}
